package LeetCode;

import java.math.BigInteger;
import java.util.Arrays;
import java.util.Stack;

/**
 * @Author Kechelle
 * @Date 2020/9/21 15:26
 * @Version 1.0
 */
public class Code66 {
    public static int[] plusOneI(int[] digits){
        for (int i= digits.length-1;i>=0;i--){
            digits[i]++;
            digits[i] = digits[i]%10;
            if (digits[i]!=0) return digits;
        }
        digits = new int[digits.length+1];
        digits[0] = 1;
        return digits;
    }

    public static void main(String[] args) {
        int[] nums = {9,8,7,6,5,4,3,2,1,0};
        System.out.println(Arrays.toString(Code66.plusOneI(nums)));
    }
}
